<?php

class Application_Form_Incident extends Zend_Form
{

	public function init()
	{
		 
		$this->setName('incident');
		$this->setAttrib('onsubmit', 'return verifier()');

		$id = new Zend_Form_Element_Hidden('id');
		$id->addFilter('Int');


		Zend_Loader::loadfile('MaterielSelect.php',APPLICATION_PATH.'/forms/element/',false);
		$materiel= new Application_Form_Element_MaterielSelect('idMateriel');
		$materiel->setLabel('Materiel')
		-> setRequired(true);

			
		$datePanne = new ZendX_JQuery_Form_Element_DatePicker(
                        'datePanne',
		array('label' => 'Date:','jQueryParams' => array('dateFormat' => 'yy-mm-dd'))
		);


		//        $datePanne = new Zend_Form_Element_Text('datePanne');
		//        $datePanne->setLabel('Date de la panne')
		//        		-> setRequired(true);
		Zend_Loader::loadfile('EmployeSelect.php',APPLICATION_PATH.'/forms/element/',false);
		$employe = new Application_Form_Element_EmployeSelect('idEmploye');
		$employe->setLabel('Declarant')
		->setRequired(true);

		$typePanne = new Zend_Form_Element_Select('typePanne') ;
		$typePanne->setLabel('Type de panne')
		->addMultiOptions(array('M' => 'Materiel', 'L' => 'Logiciel', 'R' => 'Reseau'));


		$resumePanne=new Zend_Form_Element_Text('resumePanne');
		$resumePanne->setLabel('Resumé de la panne')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');


		$details=new Zend_Form_Element_Textarea('details');
		$details->setLabel('Details')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty')
		->setAttrib('cols', '40')
		->setAttrib('rows', '4');



		//    $envoyer = new Zend_Form_Element_Submit('envoyer');
		//    $envoyer->setAttrib('id', 'boutonenvoyer');

		$this->addElements(array($id,$materiel,$datePanne,$employe,$typePanne,$resumePanne,$details));


	}


}

